package com.ysfxt.controller;


import com.ysfxt.model.SysTeacher;
import com.ysfxt.result.Result;
import com.ysfxt.service.SysTeacherService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ysfxt
 * @since 2024-03-29
 */
@RestController
@RequestMapping("/api/user")
public class TeacherController {
    @Resource
    private SysTeacherService sysTeacherService;
    
    /**
     * 登录
     * @param sysTeacher
     * @return
     */
    @PostMapping("login")
    public Result login(@RequestBody SysTeacher sysTeacher){
        return sysTeacherService.login(sysTeacher);
    }
    
    /**
     * 修改密码
     * @param sysTeacher 前端在登录后才能修改密码，所以要把id也传过来,或者后端根据token获取id
     * @return
     */
    @PostMapping("setPassword")
    public Result setPassword(@RequestBody SysTeacher sysTeacher){
        return sysTeacherService.setPassword(sysTeacher);
    }
    
}

